package org.ouwh.oowiki.ctrl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ouwh.fw.model.data.Struct;
import org.ouwh.oowiki.http.MyException;
import org.ouwh.oowiki.http.MyRequest;
import org.ouwh.oowiki.http.MyResponse;

public class InvokeTimeMonInterceptor extends AbstractInterceptor {
	private static Log log = LogFactory.getLog(InvokeTimeMonInterceptor.class);
	private long before;

	@Override
	public void beforeController(MyRequest request) throws MyException {
		before = System.currentTimeMillis();
	}

	@Override
	public void afterController(MyRequest request, MyResponse response, Struct otherParam) throws MyException {
		long elapsedTime = System.currentTimeMillis() - before;
		log.debug("controller[" + getControllerName() + "] elapsed time: " + elapsedTime);
	}

}
